package cn.edu.sptc.sms_lichaoping.service.impl;

import cn.edu.sptc.sms_lichaoping.dao.MajorMapper;
import cn.edu.sptc.sms_lichaoping.entity.Major;
import cn.edu.sptc.sms_lichaoping.service.MajorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service

public class MajorServicelmpl implements MajorService {
    @Autowired
    private MajorMapper majorMapper;

    @Override
    public boolean insertMajor(Major major) {
        int n=majorMapper.insert(major);
        if(n>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean updateMajor(Major major) {
        if(majorMapper.update(major)>0){
            return true;
        }
        return false;
    }

    @Override
    public boolean deleteMajor(Long id) {
        if(majorMapper.delete(id)>0){
            return  true;
        }
        return false;
    }

    @Override
    public List<Major> queryByAll() {
        return majorMapper.selectAll();
    }

    @Override
    public Major queryByID(Long id) {
        return majorMapper.selectByID(id);
    }
}
